import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../../config';
import { RequestClientService } from '../../request-client.service';

@Injectable({
  providedIn: 'root'
})
export class MemberManageService {

  constructor(
    private requestClientService: RequestClientService
  ) { }
  // 获取项目成员列表
  public async QueryProjectUsersPagedList(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/QueryProjectUsersPagedList`, params);
    return res;
  }
  // 创建或编辑人员
  public async AddUserOrModifyToProject(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/AddOrModifyUserToProject`, params);
    return res;
  }
  // 删除项目成员
  public async RemoveUserOnProject(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/Projects/RemoveUserOnProject`, params);
    return res;
  }
  // 批量删除人员
  public async BatchRemoveUserOnProject(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/BatchRemoveUserOnProject`, params);
    return res;
  }

  // 获取当前成员权限点
  public async QueryPermissionByProjectUser(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/QueryPermissionByProjectUser`, params);
    return res;
  }
  // 获取所有权限点
  public async GetAllPermissions(params?) {
    const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/Permission/GetAllPermissions`, params);
    return res;
  }

}